package com.example.redis.controller;

import com.example.redis.pojo.Person;
import com.example.redis.repository.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ljw
 * @description
 * @date 2022/8/4 7:41
 */
@RestController
@RequestMapping("/person")
public class PersonController {

    @Autowired
    PersonRepository personRepository;

    @RequestMapping("/save")
    public void save() {
        Person person = new Person("1", "wyf", 32);
        personRepository.save(person);
        personRepository.stringRedisTemplateDemo();
    }

    @RequestMapping("/getStr")
    public String getStr() {
        return personRepository.getString();
    }

    @RequestMapping("/getPerson")
    public Person getPerson() {
        return personRepository.getPerson();
    }
}
